﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using kim.Common;

namespace kim
{
    public partial class UpPass : kim.UI.ManagePage
    {
        private int Nid;
        protected void Page_Load(object sender, EventArgs e)
        {
            Nid = KIMRequest.GetInt("id", 1);
        }
        protected void btnSave_Click(object sender, EventArgs e)
        {
            if (FormCheck())
            {
                if (new BLL.eg_Admin().Update(kim.Common.DESEncrypt.Encrypt(txtNew.Text.Trim()), Nid))
                {
                    lblmsg.Text = "密码修改成功";
                }
            }
            else
            {
                lblmsg.Text = "原始密码不正确";
                return;
            }
        }
        
             
        private bool FormCheck()//验证用户输入
        {

            if (kim.Common.DESEncrypt.Encrypt(txtOld.Text.Trim()) != new BLL.eg_Admin().GetModel(Nid).AdminPwd)
                return false;
            else
               return true;
        }
    }
}